import { LOGIN, LOGOUT } from "../constants"

const init = {
    token: ''
}
export default function login(state = init, action) {
    if (action.type === LOGIN) {
        return {
            ...state,
            token: action.payload
        }
    }
    if (action.type === LOGOUT) {
        return {
            ...state,
            token: ''
        }
    }
    return state
}